﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DZLib.ExtendFramework.Generic;

namespace DZLib.ExtendFramework.UnitTests.Generic.ExtendIEnumerableTest
{
    [TestClass]
    public class IndexIsInRangeTest
    {
        [TestMethod]
        public void IndexIsInRangeNormalTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            Assert.IsTrue(testCase.IndexIsInRange(3));
        }

        [TestMethod]
        public void IndexIsInRangeLowBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            Assert.IsTrue(!testCase.IndexIsInRange(-1));
        }

        [TestMethod]
        public void IndexIsInRangeLowTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            Assert.IsTrue(testCase.IndexIsInRange(0));
        }

        [TestMethod]
        public void IndexIsInRangeUpTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            Assert.IsTrue(testCase.IndexIsInRange(7));
        }

        [TestMethod]
        public void IndexIsInRangeUpBoundTest()
        {
            var testCase = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            Assert.IsTrue(!testCase.IndexIsInRange(8));
        }
    }
}
